﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Evolution.Structure.Globe;
using Evolution.Structure.Globe.Units;
using EvolutionBaseTypes;
using EvolutionBaseTypes.Interfaces;

namespace Evolution.Structure

{
    public class Nation : ILoadable<Nation>
    {
        public List<Technology> StartingTechnologies { get; set; }
        public string Name { get; set; }
        public  int SeedMoney { get; set; }
        public List<Unit> StartingUnits { get; set; }
        public List<Benefit> Benefits { get; set; }
        public List<String> CityNames { get; set; }

        public Nation()
        {
            StartingTechnologies = new List<Technology>();
            StartingUnits = new List<Unit>();
            Benefits = new List<Benefit>();
            CityNames = new List<String>();
        }

        public Nation(string name, int seedMoney, List<Technology> startingTechnologies, List<Unit> startingUnits, List<Benefit> benefits, List<String> cityNames)
        {
            this.Name = name;
            this.SeedMoney = seedMoney;
            this.StartingTechnologies = startingTechnologies;
            this.StartingUnits = startingUnits;
            this.Benefits = benefits;
            this.CityNames = cityNames;
        }


        public Nation LoadData(LoaderFactory<Nation> factory)
        {
            try
            {
                Nation temp = factory.Load();
                this.StartingTechnologies = temp.StartingTechnologies;
                this.Name = temp.Name;
                this.SeedMoney = temp.SeedMoney;
                this.StartingUnits = temp.StartingUnits;
                this.Benefits = temp.Benefits;
                this.CityNames = temp.CityNames;
                return this;
            }
            catch (Exception) { return null; }
        }
    }
}
